package cn.sendto.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import cn.sendto.model.StudentEntity;

public class StudentMapper implements IRowMapper<StudentEntity> {

	@Override
	public StudentEntity rowMapper(ResultSet rs) throws SQLException {

		StudentEntity entity = new StudentEntity();

		try {
			entity.setStudentId(rs.getString("studentid"));
			entity.setStudentName(rs.getString("studentname"));
			entity.setGender(rs.getString("gender"));
			entity.setAge(rs.getInt("age"));
			entity.setAddress(rs.getString("address"));
			entity.setStudentno(rs.getString("studentno"));
			entity.setTel(rs.getString("telphone"));
			entity.setClassId(rs.getInt("classid"));
			entity.setPassword(rs.getString("password"));
			entity.setClassName(rs.getString("classname"));
	//		System.out.println("=========="+rs.findColumn("classname"));
		} catch (Exception e) {
			// TODO: handle exception
			entity.setClassName(null);
		}

		return entity;
	}

}
